/*
 * EasyBounceGameContainer.cpp
 *
 *  Created on: 2009-3-14
 *      Author: Wayne
 */

#include "EasyBounceGameContainer.h"
#include <eikbtgpc.h>
#include "coedef.h"

// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// ConstructL(const TRect& aRect)
// Two phased constructor
// ---------------------------------------------------------
//
void CEasyBounceGameContainer::ConstructL(const TRect& aRect)
    {
    CreateWindowL();
    
    iLabel= new (ELeave) CEikLabel;
    iLabel->SetContainerWindowL( *this );
    iLabel->SetTextL( _L("GameView") );
    iLabel->OverrideColorL( EColorLabelTextEmphasis, KRgbBlack );
    iLabel->OverrideColorL( EColorLabelHighlightFullEmphasis, KRgbWhite );
    iLabel->SetEmphasis( CEikLabel::EFullEmphasis ); 
    
    SetRect(aRect);
    ActivateL();
    }

// Destructor
CEasyBounceGameContainer::~CEasyBounceGameContainer()
    {
    delete iLabel;
    }

// ---------------------------------------------------------
// CEasyBounceGameContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CEasyBounceGameContainer::SizeChanged()
    {
    iLabel->SetExtent( TPoint(10,10), TSize(200,200) );
    }

// ---------------------------------------------------------
// CEasyBounceGameContainer::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CEasyBounceGameContainer::CountComponentControls() const
    {
    return 1; // return nbr of controls inside this container
    }

// ---------------------------------------------------------
// CEasyBounceGameContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CEasyBounceGameContainer::ComponentControl(TInt aIndex) const
    {
    switch ( aIndex )
        {
        case 0:
        	return iLabel;
        	break;
        default:
            return NULL;
        }
    }


// ---------------------------------------------------------
// CEasyBounceGameContainer::OffeKeyEventL()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
TKeyResponse CEasyBounceGameContainer::OfferKeyEventL(
    const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
    {
    TKeyResponse ret;

    ret = EKeyWasNotConsumed;

    return ret;
    }

// ---------------------------------------------------------
// CEasyBounceGameContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CEasyBounceGameContainer::Draw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    gc.SetPenStyle(CGraphicsContext::ENullPen);
    gc.SetBrushColor(KRgbWhite);
    gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    gc.DrawRect(aRect);
    }

// ---------------------------------------------------------
// CEasyBounceGameContainer::HandleControlEventL(
//     CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CEasyBounceGameContainer::HandleControlEventL(
    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
    {
    // Add your control event handler code here
    }

// ---------------------------------------------------------
// CEasyBounceGameContainer::HandlePointerEventL(
//     const TPointerEvent& aPointerEven)
// ---------------------------------------------------------
//
void CEasyBounceGameContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
	{
    //
	}

// End of File  
